using System;
using System.IO;
using System.Configuration;

using NUnit.Framework;

using Com.SimonProctor.Html;

namespace HtmlParserTests.Markup
{
    [TestFixture]
    public class EmptyPage : TestBase
    {
        [SetUp]
        public void Setup()
        {

            StreamReader sr = File.OpenText("TestFiles/emptypage.html"); //, FileMode.Open);
            text = sr.ReadToEnd();
            sr.Close();

            parser = new Parser();

            parser.Text += new EventHandler<TextEventArgs>(parser_Text);
            parser.StartTag += new EventHandler<StartTagEventArgs>(parser_StartTag);
            parser.EndTag += new EventHandler<EndTagEventArgs>(parser_EndTag);
            parser.Comment += new EventHandler<CommentEventArgs>(parser_Comment);
            parser.Declaration += new EventHandler<DeclarationEventArgs>(parser_Declaration);

            startTagCount = 0;
            endTagCount = 0;
            textCount = 0;
            declarationCount = 0;
            commentCount = 0;
        }

        [Test]
        public void TestEvents()
        {
            parser.Process(text);

            Assert.AreEqual(declarationCount, 1);
            Assert.AreEqual(startTagCount, 4);
            Assert.AreEqual(endTagCount, 4);
            Assert.AreEqual(textCount, 8);
        }

        
    }
}
